<?php

    class TemplateEngine
    {
        public function __construct()
        {
        }
		
        public function parse( $templatePath, $vars )
        {
            $content = file_get_contents( $templatePath );
            foreach ( $vars as $key => $value )          
            {
                $content = str_replace( $key, $value, $content );
            }
            return $content;
        }
		
		public function convertToHtml( $str )
		{
			$vars = array ( '%message%' => $str );
			return $this->parse( 'templates/convert_err_msg.tpl', $vars );
		}
    }

?>